#!/bin/bash

# 性能分析
echo "开始性能分析..."
curl "http://localhost:8080/debug/pprof/profile?seconds=30" > cpu.pprof
curl "http://localhost:8080/debug/pprof/heap" > heap.pprof
curl "http://localhost:8080/debug/pprof/goroutine" > goroutine.pprof

# 分析CPU性能
echo "分析CPU性能..."
go tool pprof -http=:8081 cpu.pprof &

# 分析内存使用
echo "分析内存使用..."
go tool pprof -http=:8082 heap.pprof &

# 分析日志
echo "分析日志..."
go run cmd/analyze/main.go

# 等待浏览器打开分析结果
echo "性能分析结果已在浏览器中打开"
echo "CPU分析: http://localhost:8081"
echo "内存分析: http://localhost:8082" 